﻿
//var times = document.getElementById("tex_start_time");
//    timee = document.getElementById("tex_end_time");

//var sec = new Array();
//sec[0] = document.getElementById("sec1");
//sec[1] = document.getElementById("sec2");

//时间监控颠倒时交换

//function time_() {
//    if (times.value > timee.value && sec[0].value != "" && sec[1].value != "" && times.value != "" && timee.value != "") {
//        let tt = times.value, ss = sec[0].value;
//        times.value = timee.value; sec[0].value = sec[1].value;
//        timee.value = tt; sec[1].value = ss;
//    }
//}

var t = moment();
document.getElementById("tex_end_time").value = t.format("YYYY-MM-DDTHH:MM");
t.add(-1, "month");
document.getElementById("tex_start_time").value = t.format("YYYY-MM-DDTHH:MM");



//时间、次序颠倒时交换
function weight_range_and_cutlength_and_time(a,b) {
    var x, y;
    x = document.getElementById(a);
        y = document.getElementById(b);

    if (x.value != "" && y.value != "" && x.value > y.value) {
        let tt = x.value;
        x.value = y.value;
        y.value = tt;
    }
}


      




var inputs = document.getElementsByTagName("input");
for (let i = 0; i < inputs.length; i++) {
    if (inputs[i].type != "datetime-local") {
        inputs[i].addEventListener("input", function (event) {
            event.target.value = event.target.value.replace(/\-/g, "")
        })
    };
}
